|
|
|
|
|
|
|
' DrawAnimatedRects Example
' Copyright © 1998 by Desaware Inc. All Rights Reserved
Option Explicit
Private Type RECT
left As Long
top As Long
width As Long
height As Long
End Type
Private Const IDANI_OPEN = 1
Private Const IDANI_CLOSE = 2
Private Const IDANI_CAPTION = 3
Private Declare Function DrawAnimatedRects Lib "user32" (ByVal hwnd _
As Long, ByVal idAni As Long, lprcFrom As RECT, lprcTo As RECT) As Long
Private Sub Command1_Click()
Dim r1 As RECT
Dim r2 As RECT
ScaleMode = vbPixels
r1.left = ScaleWidth / 2
r1.top = ScaleHeight / 2
r2.width = ScaleWidth
r2.height = ScaleHeight
Call DrawAnimatedRects(hwnd, IDANI_CAPTION, r1, r2)
End Sub |
|
|
|
|
|
|
|
|
The results of clicking the command button are odd, to say the least. The rectangle is indeed animated. But its starting and ending locations are outside the window. It is as if the coordinates in the r1 and r2 rectangles are in screen coordinates instead of relative to the window. Try passing the Command.hwnd property as a parameter to the DrawAnimatedRects function. Experimentation suggests that the function is using the hwnd parameter to determine which caption to animate instead of using the coordinates of the r1 and r2 parameters. |
|
|
|
|
|
|
|
|
Your challenge is as follows: |
|
|
|
|
|
|
|
|
1. Figure out how to get the function to perform the animation with the hwnd property set to 0 as described in the function documentation. |
|
|
|
|
|